﻿using NC.DAL;
using EmailTemplete = NC.Core.Models.EmailTemplate;
using DataEmailTemplete = NC.DAL.EmailTemplate;
using AutoMapper;

namespace NC.Core
{
    public class EmailTemplateService:IEmailTemplateService
    {
        private readonly IEmailTemplateRepository _emailTemplateService;

        public EmailTemplateService()
        {
            _emailTemplateService = new EmailTemplateRepository();
            Mapper.CreateMap<EmailTemplete, DataEmailTemplete>();
            Mapper.CreateMap<DataEmailTemplete, EmailTemplete>();
        }

        public EmailTemplete GetEmailTemplateByName(string templateName)
        {
            var emailTemplete = _emailTemplateService.GetEmailTemplateByName(templateName);
            return Mapper.Map<DataEmailTemplete, EmailTemplete>(emailTemplete);
        }
    }
}
